<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddNewFieldToGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // 为商品表添加一些计数字段
        Schema::table('goods', function (Blueprint $blueprint) {
            $blueprint->integer('sell_count')->unsigned()->comment('总销量')->index();
            $blueprint->integer('comment_count')->unsigned()->comment('总评论数')->index();
        });

        Schema::table('stores', function (Blueprint $blueprint) {
            $blueprint->dropColumn('audit_end');
        });

        Schema::table('stores', function (Blueprint $blueprint) {
            $blueprint->timestamp('audit_end')->nullable()->comment('审核通过时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
